package com.kevin.designpattern.factory_method.demo2;

public class CoffeeStore {

    public Coffee orderCoffee(String type) {

        Coffee coffee = null;
        if ("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if ("latte".equals(type)) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("对不起，您所点的咖啡不存在");
        }
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
